<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>发送请求</button>
    <button>取消请求</button>


    <script>
        let btn = document.getElementsByTagName("button")

        const xhr = new XMLHttpRequest();


        btn[0].onclick = function(){
            xhr.open('GET','http://localhost:8000/delay')
            xhr.send()
        }

        btn[1].onclick = function(){
            //手动取消发送请求  
            xhr.abort()
        }






    </script>
    
</body>
</html>